package oot.tab.activity;

import java.util.Timer;
import java.util.TimerTask;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

public class MyFractment extends FragmentActivity {
	protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i("MyFragment","first---"+ System.currentTimeMillis());
        Log.i("MyFragment","first"+ System.currentTimeMillis());
        Timer mTimer = new Timer();
        TimerTask tmTask = new TimerTask(){

			@Override
			public void run() {
				// TODO Auto-generated method stub
				Log.i("MyFragment","print"+ System.currentTimeMillis());
			}
        };
        mTimer.schedule(tmTask, 0, 1000);
        //setContentView(R.layout.fragment_stack);
	}
	public static class MyFragmentInside  extends Fragment{
		private Button bt;
		public void onCreate(Bundle savedInstanceState) {
			//Log.i("MyFragment","first"+ System.currentTimeMillis());
            super.onCreate(savedInstanceState);
            //Log.i("MyFragment","first"+ System.currentTimeMillis());
            Timer mTimer = new Timer();
            TimerTask tmTask = new TimerTask(){

    			@Override
    			public void run() {
    				// TODO Auto-generated method stub
    				Log.i("MyFragment","print"+ System.currentTimeMillis());
    			}
            };
            mTimer.schedule(tmTask, 0, 1000);
            //setContentView(R.layout.fragment_stack);
            }
		 public View onCreateView(LayoutInflater inflater, ViewGroup container,
	                Bundle savedInstanceState) {
	            View v = inflater.inflate(R.layout.fragment_stack, container, false);
	            
	            bt = (Button)v.findViewById(R.id.home);
	            Log.i("MyFragment","view oncreate" + System.currentTimeMillis());
	            bt.setOnClickListener(new OnClickListener() {
					
					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						Log.i("MyFragment","button clicked" + System.currentTimeMillis());
						
					}
				});
	            
	            //View tv = v.findViewById(R.id.text);
	            //((TextView)tv).setText("Cung duoc #");
	            //tv.setBackgroundDrawable(getResources().getDrawable(android.R.drawable.arrow_down_float));
	            return v;
	        }
	}
}
